<!DOCTYPE html>
<html>
<head>
<title>reserve.html</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/pubStyle.css" />
<style type="text/css">
<!--
body {
	background-color:#F7F7F7;
	margin: 0px;
}
-->
</style>
<script type="text/javascript" src="js/provincelink.js"></script>
<script type="text/javascript" src="js/cookie_util.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/sofa.js"></script>
<script type="text/javascript">
    var acctId = getCookie("uid");
    if (acctId == null) {
        alert("登录状态已失效,请重新登录");
        window.location.href = "index.html";
    }
    var orderSofa = getCookie("orderSofa");
    if(orderSofa == null || orderSofa == ""){
       window.location.href="sofaDetail.html";
    }
    $(function(){
        var realName = getCookie("realName");
        logOut();//退出登录功能
        $("#acctId").html(realName);
        $("#register").click(function(){
            $(".p_tip").hide();
            $(".p_chk").show();
            var custName = $("#custName1").val().trim();
            var certNum = $("#certNum1").val().trim();
            var linktel = $("#linktel1").val().trim();
            var userNumber = $("#userNumber").val().trim();
            var opentime = $("#opentime").val().trim();
            var endtime = $("#endtime").val().trim();
            if(checkIsEmpty(custName, "#tip_custName1", "#chk_custName1")){
                return;
            }
            if(checkIsEmpty(certNum, "#tip_certNum1", "#chk_certNum1")){
                return;
            }
            if(checkIsEmpty(linktel, "#tip_linktel1", "#chk_linktel1")){
                return;
            }
            if(checkIsEmpty(userNumber, "#tip_userNumber", "#chk_userNumber")){
                return;
            }
             $.ajax({
                url:"/SofaGuest/order/preOrder.do",
                type:"post",
                data:{"sofaId":orderSofa,"userId":acctId,"custName":custName,
                      "certNum":certNum,"linktel":linktel,"userNumber":userNumber,
                      "opentime":opentime,"endtime":endtime},
                dataType:"json",
                success:function(result){
                    alert(result.detial);
                    if("0000"==result.status){
                        delCookie("orderSofa");
                        delCookie("address");
                        delCookie("sex");
                        delCookie("minAge");
                        delCookie("maxAge");
                        delCookie("pernum");
                        delCookie("qryTag");
                        window.location.href="personMan.html";
                    }
                },
                error:function(){
                    alert("系统异常,请稍后重试");
                }
            });
        });
    });
</script>

</head>

<body>
<div class="top">
		<div class="top-page">
			<div id="nav-title">
				<a href="homePage.html" class="title">首页</a>
            	<a href="qrySofa.html" class="title">找沙发</a>
            	<a href="addSofa.html" class="title">我有沙发</a>
            	<a href="travelList.html" class="title">分享沙旅</a>
            	<a href="personMan.html" class="title">个人管理</a>
			</div>
			<div id="loginfo">
				<span>当前登陆：</span>
				<span id="acctId"></span>
				<span><a href="Javascript:void(0)" id="safeout"  target="_self">安全退出</a></span>
			</div>
		</div>
	</div>
	<div class="main-content">
		<div class="emp-line"></div>
		<div class="qrySofaimg" id="res-title">
			<span>&nbsp;&nbsp;申请入住</span>
		</div>
		<div class="emp-line"></div>
		<div class="res-form">
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="custName1">入住人:</label>
							</th>
							<td><input type="text" id="custName1" name="custName1"
								class="px er" tabindex="1" autocomplete="off" size="25"
								maxlength="15" required="">
							</td>
							<td class="tipcol"><i id="tip_custName1" class="p_tip"
								style="display: none;">请填写您的真实姓名</i>
							<kbd id="chk_custName1" class="p_chk">请填写您的真实姓名</kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="certNum1">身份证:</label>
							</th>
							<td><input type="text" id="certNum1" name="certNum1"
								class="px er" tabindex="1" autocomplete="off" size="25"
								maxlength="18" required="">
							</td>
							<td class="tipcol"><i id="tip_certNum1" class="p_tip"
								style="display: none;">请填写真实的身份证信息</i>
							<kbd id="chk_certNum1" class="p_chk">请填写真实的身份证信息</kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="linktel1">联系方式:</label>
							</th>
							<td><input type="text" id="linktel1" name="linktel1"
								class="px er" tabindex="1" autocomplete="off" size="25"
								maxlength="11" required="">
							</td>
							<td class="tipcol"><i id="tip_linktel1" class="p_tip"
								style="display: none;">请输入有效联系方式</i>
							<kbd id="chk_linktel1" class="p_chk">请输入有效联系方式</kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
            <div class="rfm">
                <table>
                    <tbody>
                        <tr>
                            <th><span class="rq">*</span><label for="userNumber">入住人数:</label>
                            </th>
                            <td><input type="text" id="userNumber" name="userNumber"
                                class="px er" tabindex="1" autocomplete="off" size="25"
                                maxlength="15" required="">
                            </td>
                            <td class="tipcol"><i id="tip_userNumber" class="p_tip"
                                style="display: none;">请填写入住总人数</i>
                            <kbd id="chk_userNumber" class="p_chk">请填写入住总人数</kbd>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
			<!-- <div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="custName2">入住人2:</label>
							</th>
							<td><input type="text" id="custName2" name="custName2"
								class="px er" tabindex="1" autocomplete="off" size="25"
								maxlength="15" required="">
							</td>
							<td class="tipcol"><i id="tip_custName2" class="p_tip"
								style="display: none;">请填写您的真实姓名</i>
							<kbd id="chk_custName2" class="p_chk">请填写您的真实姓名</kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="certNum2">身份证:</label>
							</th>
							<td><input type="text" id="certNum2" name="certNum2"
								class="px er" tabindex="1" autocomplete="off" size="25"
								maxlength="18" required="">
							</td>
							<td class="tipcol"><i id="tip_certNum2" class="p_tip"
								style="display: none;">请填写真实的身份证信息</i>
							<kbd id="chk_certNum2" class="p_chk">请填写真实的身份证信息</kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="linktel2">联系方式:</label>
							</th>
							<td><input type="text" id="linktel2" name="linktel2"
								class="px er" tabindex="1" autocomplete="off" size="25"
								maxlength="11" required="">
							</td>
							<td class="tipcol"><i id="tip_linktel2" class="p_tip"
								style="display: none;">请输入有效联系方式</i>
							<kbd id="chk_linktel2" class="p_chk">请输入有效联系方式</kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>  -->
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="opentime">入住时间:</label>
							</th>
							<td><input type="date" id="opentime" name="opentime"
								class="px er" tabindex="1" autocomplete="off" size="25" value="2017-01-01">
							</td>
							<td class="tipcol"><i id="tip_opentime" class="p_tip"
								style="display: none;"></i>
							<kbd id="chk_opentime" class="p_chk"></kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="rfm">
				<table>
					<tbody>
						<tr>
							<th><span class="rq">*</span><label for="endtime">离开时间:</label>
							</th>
							<td><input type="date" id="endtime" name="opentime"
								class="px er" tabindex="1" autocomplete="off" size="25" value="2017-01-01">
							</td>
							<td class="tipcol"><i id="tip_endtime" class="p_tip"
								style="display: none;"></i>
							<kbd id="chk_endtime" class="p_chk"></kbd>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="rfm">
						<table>
							<tbody><tr>
								<td><input type="submit" id="register" name="register" class="px er" tabindex="1" autocomplete="off" size="25" maxlength="15" required="" value="确认订单"></td>
								</tr></tbody>
						</table>
			</div>
		</div>
	</div>
</body>
</html>
